package edu.cicese.alz.swing;

import javax.swing.JTextField;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;

/**
 * Created by: Eduardo Quintana Contreras
 * Date: 25/07/12
 * Time: 02:04 PM
 */
public class PropertyNameDocumentFilter extends DocumentFilter {

	JTextField textField;

	public PropertyNameDocumentFilter(JTextField textField) {
		this.textField = textField;
	}

	@Override
	public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
		if (!string.equals(",") && !string.equals(";")) {
			super.insertString(fb, offset, string, attr);
		}
	}

	@Override
	public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attrs) throws BadLocationException {
		if (!string.equals(",") && !string.equals(";")) {
			super.replace(fb, offset, length, string, attrs);
		}
	}
}
